package net;

import java.util.ArrayList;
import java.util.List;

import queen.QueenCard;

import com.splashcard.cardsFace.SplashCard;
import com.splashcard.engine.SplashEngine;
import com.splashcard.message.GroupExecCallBackMessage;
import com.splashcard.message.ResultMessage;
import com.splashcard.net.CardSet;
import com.splashcard.net.SplashClient;

public class Client {
public static void main(String[] args) {
		
		List<SplashCard> cards = new ArrayList<SplashCard>();
		for(int i=0;i<30;i++){
			cards.add(new QueenCard(12,12));
		}
		
		for(int i=0;i<100;i++){
			cards.add(new QueenCard(11,11));
		}
		
		cards.add(new QueenCard(13,13));
		cards.add(new QueenCard(14,14));
		cards.add(new QueenCard(13,13));
		cards.add(new QueenCard(14,14));
		
		SplashClient splashClient = new SplashClient();
		CardSet cardSet = new CardSet();
		cardSet.setPort(7776);
		cardSet.setTargetName("localhost");
		cardSet.setCards(cards);
		splashClient.send(cardSet, new SplashClient.ClientCallBack() {

			@Override
			public void OnCallBack(Object object) {
				// TODO Auto-generated method stub
				GroupExecCallBackMessage result = (GroupExecCallBackMessage) object;
				System.out.println("callBack:" + result.getUsedTime() + " avg:"
						+ result.getAvgUsedTime() + " threads:"
						+ result.getThreads());
				System.out.println(result + "");
			}
		});

		CardSet cardSet1 = new CardSet();
		cardSet1.setPort(7777);
		cardSet1.setTargetName("localhost");
		cardSet1.setCards(cards);
		splashClient.send(cardSet1, new SplashClient.ClientCallBack() {

			@Override
			public void OnCallBack(Object object) {
				// TODO Auto-generated method stub
				GroupExecCallBackMessage result = (GroupExecCallBackMessage) object;
				System.out.println("callBack:" + result.getUsedTime() + " avg:"
						+ result.getAvgUsedTime() + " threads:"
						+ result.getThreads());
				System.out.println(result + "");
			}

		});
		

	}

}
